/**
 * Created by dukes on 2016/2/29.
 */
class GuildListRender extends eui.ItemRenderer {
    public constructor() {
        super();
        this.skinName = "skins.scene.elements.GuildItemSkin";
    }

    public dataChanged(){
        super.dataChanged();
        // this.lab_name.text = this.data.name;
        // this.lab_level.text = this.data.level+"";
        // this.lab_cnt.text = this.data.currMemberCount+"/"+this.data.maxMemberCount;
        // var applied = GuildMgr.getInstance().myApplies.indexOf(this.data.id) != -1;
        // this.img_apply.source = RES.getRes(applied ? "img_applied":"img_apply");
        // this.img_apply.touchEnabled = !applied;
    }

    private onApply(evt:egret.TouchEvent){
        // if(GuildMgr.getInstance().myApplies.indexOf(this.data.id) == -1)
        //     window["__apply"](this.data.id);
        // else
            ShowHint("已申请");

    }

    private lab_name:eui.Label;
    private lab_level:eui.Label;
    private lab_cnt:eui.Label;
    private img_apply:eui.Image;
    public partAdded(name:string, instance:any){
        super.partAdded(name,instance);
        if( name == "lab_name"){
            this.lab_name = instance;
        }else if( name == "lab_level"){
            this.lab_level = instance;
        }else if( name == "lab_cnt"){
            this.lab_cnt = instance;
        }else if( name == "img_apply"){
            this.img_apply = instance;
            this.img_apply.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onApply, this);
        }
    }
}